<?php
$current_page = "ornitologos";
header("Content-Type: text/html; charset=utf-8");

$jsonurl = "http://nibble.li/twittertido/web/topUsers.php";
$json = file_get_contents($jsonurl, 0, null, null);
$json_output = json_decode($json, true);
$arrays = $json_output['users'];
?>
<?php include_once("detect.php"); ?>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Twittertido - Procastination everywhere!!!</title>
        <link rel="stylesheet" href="css/glamour.css" />
        <script src="js/jquery-1.6.2.min.js"></script>
        <script src="js/common.js"></script>
        <script type="text/javascript">

            var _gaq = _gaq || [];
            _gaq.push(['_setAccount', 'UA-28972217-1']);
            _gaq.push(['_trackPageview']);

            (function() {
                var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
                ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
                var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
            })();

        </script>
    </head>
    <body>
        <?php include_once("header.php"); ?>
        <div class="wrapper">
            <div class="content">
                <div class="tweets">
                    <?php $i = -1;
                    foreach ($arrays as $user) { ?>
                        <?php $i++;
                        if ($i == 10) { ?>
                            <script type="text/javascript"><!--
                                google_ad_client = "ca-pub-4013617504060877";
                                /* Twittertido Desktop */
                                google_ad_slot = "7224782497";
                                google_ad_width = 468;
                                google_ad_height = 60;
                                //-->
                            </script>
                            <script type="text/javascript"
                                    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
                            </script>
                        <?php } ?>
                        <?php
                        $aux = $i % 10;
                        if ($aux > 0) {
                            $class = "bg_$aux";
                        } else {
                            $class = "";
                        }
                        ?>

                        <div class="wrapper_tweet <?php print $class; ?>">
                            <div class="tweet">
                                <table>
                                    <tr>
                                        <td class="avatar">
                                            <img src="https://api.twitter.com/1/users/profile_image?screen_name=<?php print $user['user_tweet']; ?>&size=normal" />
                                        </td>
                                        <td>
                                            <a href="http://twitter.com/#!/<?php print $user['user_tweet']; ?>" target="_blank" class="link" >
                                                <div class="title" ><?php print $user['user_tweet']; ?></div>
                                            </a>
                                            <div class="mb_five"><?php print $user['total']; ?> tweets publicados</div>

                                        </td>
                                    </tr>
                                </table>
                            </div>
                            <div class="clear"></div>
                            <div>

                            </div>
                        </div>
                    <?php } ?>
                </div>
                <div class="clear"></div>
            </div>
        </div>

    </body>
</html>
